package May._11.work2;

import May._11.work2.Dao.AccountDaoImpl;
import untils.ConnectionUtils;

import java.math.BigDecimal;
import java.sql.Connection;
import java.sql.Statement;

public class Main {
    public static void main(String[] args) {
        try {
            //创建数据库并插入数据
            Connection connection = ConnectionUtils.getConnection();
//            Statement statement = connection.createStatement();
//            String sql = null;
/*            sql = "create table account (id int,name VARCHAR(50),money int);";
            int i = statement.executeUpdate(sql);*//*
            sql = "INSERT INTO account (id,name,money) VALUES (1,'张三',1000);";
            statement.executeUpdate(sql);
            sql = "INSERT INTO account (id,name,money) VALUES (2,'李四',6000);";
            statement.executeUpdate(sql);*/

            //转账
            AccountDaoImpl accountDao = new AccountDaoImpl();
            accountDao.selectMoneyByName("张三");
            accountDao.updateMoneyByName("张三",BigDecimal.valueOf(500));
            accountDao.updateMoneyByName("李四",BigDecimal.valueOf(6500));

        } catch (Exception e) {
            throw new RuntimeException(e);
        }

    }
}
